﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using KMFrame.Core;
using SzCourt.Logic.BLL;

namespace SzCourt.WebSite.shenwu
{
    public partial class fygg : System.Web.UI.Page
    {
        public int PageIndex = 1;
        public int PageSize = 10;
        public int TotalPage = 1;
        private string Date = string.Empty;
        private string Keyword = string.Empty;
        private string CourtPlace = string.Empty;
        private string CaseName = string.Empty;


        protected void Page_Load(object sender, EventArgs e)
        {
            getList();
        }

        private void getList()
        {
            //获取参数
            this.PageIndex = string.IsNullOrEmpty(Request.QueryString["PageIndex"]) ? 1 : Convert.ToInt32(Request.QueryString["PageIndex"]);
            this.Keyword = string.IsNullOrEmpty(Request.QueryString["keyword"]) ? "" : Request.QueryString["keyword"];
            this.Date = string.IsNullOrEmpty(Request.QueryString["date"]) ? "" : Request.QueryString["date"];
            this.CourtPlace = string.IsNullOrEmpty(Request.QueryString["CourtPlace"]) ? "" : Request.QueryString["CourtPlace"];
            this.CaseName = string.IsNullOrEmpty(Request.QueryString["CaseName"]) ? "" : Request.QueryString["CaseName"];
            
            //初始化参数            
            this.txtCaseName.Value = this.CaseName;
            this.txtDate.Value = this.Date;
            this.txtKeyword.Value = this.Keyword;
            this.sltCourtPlace.Value = this.CourtPlace;

            //调用方法
            CourtNoticeCondition param = new CourtNoticeCondition();
            param.PageIndex = this.PageIndex;
            param.PageSize = this.PageSize;
            
            if(this.Date.Length>0){
                param.CourtDay = DateTime.Parse(this.Date);
            }
            param.CaseName = this.CaseName;
            param.CourtPlace = this.CourtPlace;
            param.KeyWord = this.Keyword;

            Court art = new Court();
            PageResult result = (PageResult)art.GetCourtNoticePage(param);

            if (result != null)
            {
                this.rptDataList.DataSource = result.ResultList;
                this.rptDataList.DataBind();

                this.pager1.RecordCount = result.TotalCount;
                this.pager1.TotalPage = result.PageCount;
                this.pager1.PageIndex = this.PageIndex;
                this.pager1.PageSize = this.PageSize;
                this.pager1.LinkUrl = "/shenwu/fygg.aspx?PageIndex=" + this.PageIndex.ToString() + "&keyword=" + this.Keyword + "&date=" + this.Date + "&CaseName=" + this.CaseName + "&CourtPlace=" + this.CourtPlace;
                this.pager1.IsResult = false;
                this.pager1.IsNext = "2";
            }


        }

    }
}